/* -----------------
* brief
* 1. this is code gen by tools
* 2. array like [a,b,c] after each field, define the ui html tag in view,
		a for title,
		b for show or not , (onlyread is trial feature)
		c for element html tag , currently support : check、radio、select、input、textarea、upload
* 3. XXX
*/
//go:generate legogen -type=Orders -kv=ModuleName=orders,PrjName=saas_sys_base -dirconf=../../.. ./Orders.go

/*使用方法一(go generate)：在工程root目录下，执行go generate ./modules/orders/models

使用方法二(legogen)：直接调用生成命令
legogen -type=Orders -kv=ModuleName=merchantCard,PrjName=saas_sys_base -dirconf=./. ./modules/orders/models/Orders.go
*/

package orders

import (
	"github.com/mjiulee/lego"
	"time"
)

func init() {
	lego.AddBeanToSynList(new(Orders))
}

/* table: "tb_orders"
 * -----------------
 */
type Orders struct {
	Id    int64  `xorm:"pk" json:",string"` // ["id","hide","hidden"]
	IfDel int    `xorm:"default 0"`         // ["deleted","hide","hidden"]
	Cdate string `xorm:"DateTime created"`  // ["create","show","datetime"]
	Udate string `xorm:"DateTime updated"`  // ["update","show","datetime"]
	// add your custom field here

	OrderCode string `xorm:"varchar(255)  "` // ["订单号","show","input"]

	Uid int64 `xorm:"BigInt" json:",string"` // ["uid","show","input"]

	TenantId int64 `xorm:"BigInt" json:",string"` // ["TenantId","show","input"]

	EShopId int64 `xorm:"BigInt" json:",string"` // ["EShopId","show","input"]

	UserName string `xorm:"varchar(255)  "` // ["下单人名","show","input"]

	Mobile string `xorm:"varchar(255)  "` // ["联系电话","show","input"]

	OrderType int `xorm:"default 0"` // ["订单类型","show","input"]

	Province string `xorm:"varchar(255)  "` // ["收货地址省","show","input"]

	City string `xorm:"varchar(255)  "` // ["收货地址市","show","input"]

	Area string `xorm:"varchar(255)  "` // ["收货地址区","show","input"]

	Address string `xorm:"varchar(500)  "` // ["收货地址","show","input"]

	TradeNo string `xorm:"varchar(255)  "` // ["支付交易号","show","input"]

	ProAmount int64 `xorm:"BigInt  "` // ["订单金额 此金额为商品原始金额综合","show","input"]

	PayableAmount int64 `xorm:"BigInt  "` // ["应付金额","show","input"]

	RealAmount int64 `xorm:"BigInt  "` // ["实付金额 用于各种抵扣过后的金额，真实客户从银行账户扣除的金额","show","input"]

	BalanceAmout int64 `xorm:"BigInt  "` // ["余额抵扣","show","input"]

	Postage int64 `xorm:"BigInt  "` // ["邮费","show","input"]

	DiscountFee int64 `xorm:"BigInt  "` // ["优惠金额","show","input"]

	Remark string `xorm:"varchar(500)  "` // ["备注","show","input"]

	IfPay int `xorm:"default 0"` // ["付款状态","show","input"]

	PayTime time.Time `xorm:"DateTime"` // ["付款时间","show","datetime"]

	IfCancel int `xorm:"default 0"` // ["取消订单标志","show","input"]

	CancelTime time.Time `xorm:"DateTime"` // ["取消时间","show","datetime"]

	IfDelivery int `xorm:"default 0"` // ["是否发货","show","input"]

	DeliveryTime time.Time `xorm:"DateTime"` // ["发货时间","show","datetime"]

	IfFinish int `xorm:"default 0"` // ["是否完成","show","input"]

	IfRefund int `xorm:"default 0"` // ["是否申请退款","show","input"]

	LogisticsId int64 `xorm:"BigInt" json:",string"` // ["LogisticsId","show","input"]

	LogisticsCompany string `xorm:"varchar(255)  "` // ["物流公司","show","input"]

	LogisticsNo string `xorm:"varchar(255)  "` // ["物流单号","show","input"]

	OrderDetails []*OrderDetail `xorm:"-"` //订单明细

}

//订单类型
const (
	Nomal    = 1
	Delivery = 2
)

//订单状态
const (
	AllOrder             = 0
	UnPayOrder           = 1
	PayOrderWaitDelivery = 2
	SendedOrder          = 3
	FinishOrder          = 4
	CancelOrder          = 5
	RefundOrder          = 6
)

const (
	NoRefund     = 0
	Refunding    = 1
	AgreeRefund  = 2
	RefuseRefund = 3
)
